<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>layout布局页面</title>
    <script type="text/javascript" src="../js/jquery-1.8.3.js"></script>
    <script type="text/javascript" src="../js/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../js/easyui/locale/easyui-lang-zh_CN.js"></script>
    <link rel="stylesheet" href="../js/easyui/themes/default/easyui.css"/>
    <link rel="stylesheet" href="../js/easyui/themes/icon.css"/>
    <!--引入ztree-->
    <script src="../js/ztree/jquery.ztree.all-3.5.js"></script>
    <link rel="stylesheet" type="text/css" href="../js/ztree/zTreeStyle.css"/>

    <script>
        // 页面加载执行
        $(function () {
            //1进行ztree菜单设置
            var setting = {
                data: {
                    simpleData: {
                        enable: true	//支持简单json数据格式
                    }
                },
                callback:{
                    onClick:function (event, treeId, treeNode, clickFlag) {
                        // 开启一个新的tab页面
                        var content = '<div style="width:100%;height:100%;overflow:hidden;">'
                            + '<iframe src="'
                            + treeNode.page
                            + '" scrolling="auto" style="width:100%;height:100%;border:0;" ></iframe></div>';

                        //没有page树形菜单,不打开选项卡
                        if (treeNode.page!=undefined && treeNode.page!=""){

                            //如果选项卡已经打开,选中
                            if ($("#mytabs").tabs('exists',treeNode.name)){
                                //选中选项卡
                                $("#mytabs").tabs('select',treeNode.name);
                            }else {
                                //添加选项卡
                                $("#mytabs").tabs('add', {
                                    title: treeNode.name,
                                    content: content,
                                    closable: true
                                });
                            }


                        }
                    }
                }
            };
            //2提供ztree树形菜单数据
            var zNodes = [
                {id: 1, pId: 0, name: "父节点1"},
                {id: 2, pId: 0, name: "父节点2"},
                {id: 11, pId: 1, name: "熊猫",page:"https://www.panda.tv/"},
                {id: 12, pId: 1, name: "全民TV",page:""},
                {id: 13, pId: 2, name: "虎牙",page:"http://www.huya.com"},
                {id: 14, pId: 2, name: "传智播客",page:"http://www.itcast.com"}
            ];

            //3生成菜单
            $.fn.zTree.init($("#baseMenu"), setting, zNodes);
        });

    </script>
</head>
<body class="easyui-layout">
<div data-options="region:'north',title:'传智播客管理系统'" style="height: 100px;">北部区域</div>
<div data-options="region:'west',title:'菜单导航'" style="width: 180px;">
    <!--折叠面板-->
    <div class="easyui-accordion" data-options="fit:true">
        <div data-options="title:'基础菜单'">
            <!--通过ztree插件,制作树形菜单-->
            <ul id="baseMenu" class="ztree"></ul>
        </div>
        <div data-options="title:'系统菜单'">系统1</div>
    </div>
</div>
<div data-options="region:'center'">
    <!--选项卡面板-->
    <div id="mytabs" class="easyui-tabs" data-options="fit:true">
        <div data-options="title:'选项卡面板1',closable:true">选项卡1</div>
        <div data-options="title:'选项卡面板2',closable:true">选项卡2</div>

    </div>

</div>
<div data-options="region:'east'" style="width: 80px;">东部区域</div>
<div data-options="region:'south'" style="height: 80px;">南部区域</div>
</body>
</html>
